package uk.ac.lkl.lpp.ui;



import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JLabel;

import uk.ac.lkl.common.ui.View;
import uk.ac.lkl.lpp.model.ldo.TeachingMethod;


/**
 * HACKED by Yishay: disable the HyperLinkButtons, so the links are read from
 * the PlanElement or Messages.properties
 * 
 * @author Darren
 * 
 */
public class LinkingTeachingMethodView extends View<TeachingMethod> {

    private JButton button;


    public LinkingTeachingMethodView(TeachingMethod teachingMethod) {
        super(teachingMethod);
        setLayout(new BorderLayout(1, 1));

        addButton(teachingMethod);
    }


    private void addButton(TeachingMethod teachingMethod) {
        button = Messages.makeJButton(
                                      teachingMethod.getTitle(),
                                      null,
                                      teachingMethod.getDescription(),
                                      teachingMethod.getLink());
        add(button, BorderLayout.CENTER);
    }


    public void updateView() {
        TeachingMethod teachingMethod = getModel();

        if (button != null)
            remove(button);

        addButton(teachingMethod);
    }

}
